@echo off
:: UTF-8
chcp 65001 >nul

:: 获取当前脚本所在目录
cd /d "%~dp0%"

set VENV_PATH=.\iot-env\Scripts\activate

echo.
echo 正在运行串口模拟器...
start "Serial Sender" cmd /k "%VENV_PATH% && python .\serial_sender.py"

echo.
echo 正在运行 MQTT 数据发布器...
start "Data Publisher" cmd /k "%VENV_PATH% && python .\data_publisher.py"

echo.
echo 正在启动主程序 app.py...
start "Main App" cmd /k "%VENV_PATH% && python .\app.py"

echo.
echo 正在监听控制指令...
start "Control Subscriber" cmd /k "%VENV_PATH% && python .\control_subscriber.py"

echo.
echo 所有组件已启动完毕
pause >nul